import { defineStore } from "../index";
import type { SettingState } from "@model/store";

const useSettingStore = defineStore("setting", {
	state: (): SettingState => ({
		lang: "zh-cn", // 语言
		collapse: false, // 折叠 menu
		layoutSize: "small", // 全局 element-plus size
		openLogo: true, // 标题 logo
		keepHeader: true, // 固定头部
		keepTabs: true, // 固定tabs
		openTabs: true, // 开启tabs
		uniqueOpened: true, // 是否保持一个子菜单的展开
		openBreadcrumb: true, // 开启面包屑
		keepAside: false, // 固定 aside
		isHandleAsideFixed: false, // 是否 用户手动点击固定 aside
		navMode: "side", // 布局方式
		styleMode: "dark", // 风格
		routerTrans: "fade",
		asideMixinFixed: false,
		mixinInverted: false,
		menuSegmentation: false,
	}),
	getters: {},
	actions: {
		setValue<T = any>(key: string, value: T) {
			this[key] = value;
		},
	},
});

export default useSettingStore;
